home *** CD-ROM | disk | FTP | other *** search
/ USA Bestseller / USA BESTSELLER Vol 1-95 (Hepp-Computer)(1995).iso / e204 / examples.doc < prev    next >
Text File  |  1994-08-16  |  7KB  |  223 lines

  1. The Ultimate Calculator 2.4 (UNREGISTERED version)  [F1] for help
  2. Copyright (C) 1992-1994 by Daniel Corbier.  All rights reserved.
  3.  
  4. ucalc> ;*******************************************************************
  5. ucalc> ;  This text file is a sample session which demonstrates some of the
  6. ucalc> ;  features available in the Ultimate Calculator.  The sections are
  7. ucalc> ;  entitled:
  8. ucalc> ;
  9. ucalc> ;  1. General Calculations
  10. ucalc> ;  2. Physics for Thought
  11. ucalc> ;  3. HBO for Thought
  12. ucalc> ;  4. Are you converted yet?
  13. ucalc> ;  5. Let's use some FORCE
  14. ucalc> ;  6. How to pay
  15. ucalc> ;  7. Let's get a few FACTS straight
  16. ucalc> ;*******************************************************************
  17. ucalc> 
  18. ucalc> ; ***********************
  19. ucalc> ; 1. General Calculations
  20. ucalc> ; ***********************
  21. ucalc> 
  22. ucalc> 17*(5+8)^2
  23. Answer:  2873
  24.  
  25. ucalc> cos(pi)+8/pi + sinh(14)
  26. Answer:  601303.688561062095
  27.  
  28. ucalc> test(x) = x^pi + sin(x)   ; User defined function.
  29. ucalc> test(14)
  30. Answer:  3988.18506502600842
  31.  
  32. ucalc> sum(x*2+3^x,1..100)       ; Summation
  33. Answer:  7.73066281098016997E+47
  34.  
  35. ucalc> 
  36. ucalc> ; **********************
  37. ucalc> ; 2. Physics for Thought
  38. ucalc> ; **********************
  39. ucalc> 
  40. ucalc> mass   = 77.2     ; g
  41. ucalc> Volume = 4.0      ; cm^3
  42. ucalc> 
  43. ucalc> mass / Volume     ; Density
  44. Answer:  19.3
  45.  
  46. ucalc> 
  47. ucalc> mass = 13         ; Lets try a different mass
  48. ucalc> 
  49. ucalc> mass / Volume     ; Now lets see the new density
  50. Answer:  3.25
  51.  
  52. ucalc> ; Quantum Mechanics
  53. ucalc> 
  54. ucalc> h = 6.63E-34      ; J s
  55. ucalc> m = 9.11E-31      ; kg
  56. ucalc> L = 2E-11         ; m
  57. ucalc> 
  58. ucalc> E(x) = (h^2/(8*m*L^2))*x^2  ; Allowed energies for a particle in a box.
  59. ucalc> 
  60. ucalc> E(1)
  61. Answer:  1.50785194840834248E-16
  62.  
  63. ucalc>              ; Oops, you meant L=2E-10, no problem use the Up arrow.
  64. ucalc> L = 2E-10
  65. ucalc> E(1)       ; You didn't have to retype the eq. !  Time saver, isn't it?
  66. Answer:  1.50785194840834248E-18
  67.  
  68. ucalc> E(5)
  69. Answer:  3.7696298710208562E-17
  70.  
  71. ucalc> 
  72. ucalc> ; ******************
  73. ucalc> ; 3. HBO for Thought
  74. ucalc> ; ******************
  75. ucalc> 
  76. ucalc> mode hbo        ; Results will be displayed in Hex, Binary, and Octal
  77. ucalc> 
  78. ucalc> #h1E or #hAFF   ; ORing two hexadecimal numbers
  79. Decimal:  2815     Hex:  AFF     Binary:  101011111111     Octal:  5377
  80.  
  81. ucalc> 
  82. ucalc> $1E or $AFF     ; Same as above (shortcut notation for hex)
  83. Decimal:  2815     Hex:  AFF     Binary:  101011111111     Octal:  5377
  84.  
  85. ucalc>
  86. ucalc> #b1010101 or #b111000 + 44/2
  87. Decimal:  95     Hex:  5F     Binary:  1011111     Octal:  137
  88.  
  89. ucalc> 
  90. ucalc> mode hbo        ; Toggle HBO mode back off
  91. ucalc> 
  92. ucalc> ; *************************
  93. ucalc> ; 4. Are you converted yet?
  94. ucalc> ; *************************
  95. ucalc> 
  96. ucalc> feet_inches(x) = x * 12       ; You can put these and more in
  97. ucalc> meters_feet(x) = 3.281 * x    ; UCELC.DEF if you use them often.
  98. ucalc> celsius_fa(x)  = 9/5 * x + 32 ; Celsius to Fahrenheit.
  99. ucalc> 
  100. ucalc> celsius_fa(50)
  101. Answer:  122
  102.  
  103. ucalc> feet_inches(3)
  104. Answer:  36
  105.  
  106. ucalc>
  107. ucalc> ; ***********************
  108. ucalc> ; 5. Let's use some FORCE
  109. ucalc> ; ***********************
  110. ucalc>
  111. ucalc> ; FORCE = integral( pgh dA )
  112. ucalc>
  113. ucalc> integ(6.24*(3-x)*2*sqr(9-x^2),-3..3)
  114. Answer:  529.07649351285467
  115.  
  116. ucalc> integ(3*x^2*(x+7),4..7,500)  ; 500 subdivisions for higher precision
  117. Answer:  3561.75
  118.  
  119. ucalc>
  120. ucalc> ; *************
  121. ucalc> ; 6. How to pay
  122. ucalc> ; *************
  123. ucalc>
  124. ucalc> ; You can do all your financial calculations with Ucalc.
  125. ucalc>
  126. ucalc> ; Lets take a loan to buy a nice house
  127. ucalc>
  128. ucalc> payment(PV,i,n) = PV*i/(1-(1+i)^(-n))   ; Formula for monthly payments
  129. ucalc>
  130. ucalc> PV = 175000           ; Loan balance
  131. ucalc> i  = .01              ; Interest rate (1% monthly)
  132. ucalc> n  = 240              ; Number of payments (20 years)
  133. ucalc>
  134. ucalc> payment(PV,i,n)
  135. Answer:  1926.90073374681746
  136.  
  137. ucalc> n  = 360              ; Maybe we can negotiate better terms
  138. ucalc>
  139. ucalc> payment(PV,i,n)
  140. Answer:  1800.07204461963275
  141.  
  142. ucalc> payment(215000,i,n)       ; Can we afford a bigger loan?
  143. Answer:  2211.51708338983452
  144.  
  145. ucalc>
  146. ucalc> ; You want to become a millionaire by investing $50,000 and
  147. ucalc> ; earning 14% interest each year.  How many years will it take?
  148. ucalc>
  149. ucalc> Term(FV,PV,i) = ln(FV/PV) / ln(1+i)
  150. ucalc>
  151. ucalc> FV = 1000000          ; Future investment value
  152. ucalc> PV = 50000            ; Present investment value
  153. ucalc> i  = .14              ; Annual interest
  154. ucalc>
  155. ucalc> Term(FV,PV,i)
  156. Answer:  22.8632526947680305
  157.  
  158. ucalc> ; It will take around 23 years
  159. ucalc>
  160. ucalc> ; *********************************
  161. ucalc> ; 7. Let's get a few FACTS straight
  162. ucalc> ; *********************************
  163. ucalc>
  164. ucalc> FACT(1500)*2
  165. Answer:  9.62399559355954973E+4114
  166.  
  167. ucalc> 1500!*2   ; version 2.4 now supports the factorial (!) symbol.
  168. Answer:  9.62399559355954973E+4114
  169.  
  170. ucalc> ; Wow, not even the US budget deficit is that big of a number.
  171. ucalc> ; Can your pocket calculator get a factorial that high?
  172. ucalc>
  173. ucalc> solve( exp(x)+3*x = 15 )
  174. Answer:  2.14698767937181217
  175.  
  176. ucalc>             ; 'last' stores the answer to the previous operation.
  177. ucalc> exp(last)+3*last  ; You can use that concept for accuracy checks.
  178. Answer:  15
  179.  
  180. ucalc> solve( sin(x) = 1, 0..pi )
  181. Answer:  1.57079632679489662
  182.  
  183. ucalc> sumtable(x^2+2*x,0..10)
  184. Count         Value         Cumulative
  185.  0             0             0
  186.  1             3             3
  187.  2             8             11
  188.  3             15            26
  189.  4             24            50
  190.  5             35            85
  191.  6             48            133
  192.  7             63            196
  193.  8             80            276
  194.  9             99            375
  195.  10            120           495
  196.  
  197. Answer:  495
  198.  
  199. ucalc>
  200. ucalc> ; Compound functions can be defined by using relational operators.
  201. ucalc>
  202. ucalc> ;           /  x^2+3,       x > 0
  203. ucalc> ; tst(x) = |   2,           x = 0
  204. ucalc> ;           \  x^2-3,       x < 0
  205. ucalc>
  206. ucalc> tst(x) = (x^2+3)*(x>0)  +  (2)*(x=0)  +  (x^2-3)*(x<0)
  207. ucalc> tst(15)
  208. Answer:  228
  209.  
  210. ucalc> tst(-8)
  211. Answer:  61
  212.  
  213. ucalc> 3*tst(0)^2+pi
  214. Answer:  15.1415926535897932
  215.  
  216. ucalc>
  217. ucalc> ; These are just some of the things you can do with Ucalc.
  218. ucalc>
  219. ucalc> ; Please remember to pay the registration fee.  This will allow me
  220. ucalc> ; spend the necessary amount of time in order to add some of the
  221. ucalc> ; features that you would like to see in the next version.
  222. ucalc>
  223.